package com.example;

import com.example.service.PcServiceImpl;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
public class SpringAiApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringAiApplication.class, args);
    }

    @Bean
    public CommandLineRunner commandLineRunner(PcServiceImpl crawlerService) {
        return args -> {
            System.out.println("程序启动，开始执行爬虫任务...");
            String result = crawlerService.startCrawler();
            System.out.println("爬虫执行结果: " + result);
        };
    }
}